NetCloak 2.5 User's Guide

Utility Commands


<FLIPMODE>

The FLIPMODE command, which accepts no parameters, simply changes the current mode from SHOW to HIDE, or vise-versa. It is handy when you want to display one of two possible sections of HTML with IF/THEN/ELSE logic. For example, if you have two HTML snippets, one for table-compliant browsers and one for others, you could:

     <HIDE><SHOW_CLIENT !SupportsTables>     Advanced HTML goes here!
     <FLIPMODE>     This is visible only to browsers that don't support tables...
     <SHOW>

In this case, FLIPMODE doesn't save much, but it can be very handy when you have created a complex condition and simply want to turn on the faucet "for everyone else".

<NETCLOAK setting = value>

The NetCloak command is used to set configuration options for a single page, or even for only part of a page. These options, when set using this command, will supercede the default settings that have been defined in NetCloak. However, the revised setting will only be in effect for the page in which the NETCLOAK command is used. Other pages being served will be unaffected by temporary configuration changes made with the NETCLOAK command.

There are two configuration options that can be set using this command:

TRANSLATION

This sets the character translation mode for text following the command. Possible values are:

ENTITIES - Convert Mac characters to HTML Entities.

LATIN - Convert Mac characters to the ISO-Latin-1 charset.

NONE - No character conversion.

For example, to have NetCloak perform MacRoman to ISO-Latin-1 character translation, you could use the command:

     <NETCLOAK TRANSLATION = LATIN>

LASTMOD

This allows you to change the "Last Modified" field of the HTTP header for the page on which the command appears. Possible values include:

FILE - Return the file's last modified date in the HTTP header.

NOW - Return the current date and time in the last modified field of the HTTP header.

NONE - Leave the last modified field out of the header entirely.

For example, assume you have a page with numerous sections of random content, but you have set NetCloak to return the file's modification date as the Last-Modified date of the HTTP header, by default. For the page in question, you can override this default by including the command:

     <NETCLOAK LASTMOD = NOW>

This will cause the browser to recognize the fact that the page is constantly changing, and perform caching appropriately.

<INSERT_BEEP>

At first glance, this command may not seen to be useful, but there are several cases in which it can be handy. The INSERT_BEEP command causes the server to play the default system alert sound whenever the command is encountered. Nothing is inserted into the text of the page being served. The only effect is a system beep on the server.

You can use INSERT_BEEP while you are developing pages with NetCloak commands to verify that NetCloak is processing the page.

Another possible use for this command is in your server's error page. By including the command INSERT_BEEP on the error page, your server will beep any time an incorrect URL is processed by your server. This can give you a warning of broken links on your site as they are happening.

<REDIRECT "URL">

The REDIRECT command is a little different from most other NetCloak commands. When this command is encountered in your cloaked HTML document, all processing of the page will immediately cease, and a "redirect" header will be sent to the browser. This causes the browser to immediately transfer to the URL specified.

Note that a REDIRECT command causes all other contents of the page to be ignored. The redirect will not cause the redirected page to appear within the text of the original page.

The command will not cause a redirect to occur if it is hidden by another NetCloak command, so redirects can be performed conditionally based on any SHOW and HIDE commands. The redirect command can be used in the server's error file to automatically send clients accessing bad URLs to the correct pages. You might also use the command to redirect an HTML page to a page that might be in a completely different format depending on the client's browser type, address or other information.

Here is an example of using REDIRECT to send a special "internal use only" page based on the user's TCP/IP address. In the example, users in the domain "192.1." will be sent to the page "Protected.html". All other users will receive the public page.

     <HIDE>     <SHOW_DOMAIN 192.1.>     <REDIRECT "http://my.server/Protected.html">     <SHOW>     <HTML>     <TITLE>Public Home Page</TITLE>     <BODY>     Welcome to our public Home Page!
     </BODY>     </HTML>

<EXEC_CGI "application name" "direct" "begin filter" "end filter">

This command allows you to dynamically execute CGIs and insert their response into a page, as well as execute multiple CGIs from a single client request. These can be either other commercial CGIs, or CGIs that you write yourself. For a detailed description of how back-end CGIs work, see the section "Using NetCloak With Other CGIs" earlier in this User's Guide.

The EXEC_CGI command accepts up to four parameters, though the second, third and fourth are optional. The "application name" is simply the name of the CGI application you would like to execute. The application name must be the name (and path, where applicable) to the actual application, not an alias or a document created by or for the application that will be run.

The "direct" parameter allows you to overwrite the direct parameter sent to the CGI. Leaving this parameter blank will simply pass along the direct parameter as it originally came from the server, but overwriting this is an important capability. By changing the parameter, you can make the CGI think that the requested URL was different than it really was. This parameter also replaces the "Script Name" field, so that CGIs that function as actions will work properly.

Maxum has produced a simple, freeware CGI named "Responder" which is useful for testing or demonstrating the EXEC_CGI command. Responder simply echoes the CGI request that is sent to it as an HTML page listing the various parameters separately. Here is a snippet that will include Responder's output in an HTML page served by NetCloak:

     <EXEC_CGI "Responder.cgi">

You can download Responder from the Maxum Web site at "http://www.maxum.com/".

In many cases, you may want only a portion of the CGI response. In the case of Responder, you might want only the BODY of the complete HTML page that it returns. You can filter out what you don't want by specifying a beginning and an ending phrase. Only text that appears between the phrases will then be show in the final page. Notice that you must specify the direct parameter (even if it is left blank) in order to use the filtering function. For example:

     <EXEC_CGI "Responder.cgi" "" "<BODY>" "</BODY>">

This example would include only the parts of Responder's response that are between, but not including, the <BODY> and </BODY> tags.

Note that the EXEC_CGI command does not allow setting query or post arguments. (Query arguments are included in a CGI request URL preceeded by a question mark; post arguments are sent as data from an HTML form.) EXEC_CGI therefore cannot be used with CGIs that depend on these for input. This typically includes database access CGIs, as well as search tools such as Phantom. If you have a CGI that depends on query or post arguments, consider running it as a back-end to NetCloak instead.

<MACRO "macro name">

The Macro command is used to insert text or HTML from a local file or predefined macros. If the specified macro name matches the name of a macro defined in the "NetCloak.macros" file, NetCloak will insert the contents of that macro into the HTML in place of the MACRO command. If the macro name is a pathname for a file, NetCloak will insert the contents of the specified file. Pathnames must be relative to the NetCloak root folder.

If NetCloak is unable to insert a specified macro, it will insert an error message enclosed in an HTML comment. View the HTML source of the document after it is served to a Web browser to see the error message.

See the "Macros" section for more information on defining and using macros.


[ Command Listing | Table Of Contents ]

Copyright © 1996-7 Maxum Development Corporation
820 South Bartlett Road - Suite 104
Streamwood, IL 60107
http://www.maxum.com/